﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdRxEventReactor : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdRxEventReactor(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdRxEventReactor_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdRxEventReactor obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdRxEventReactor()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdRxEventReactor(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdRxEventReactor cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdRxEventReactor_cast(OdRxObject.getCPtr(pObj));
			OdRxEventReactor result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdRxEventReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdRxEventReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdRxEventReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdRxEventReactor_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdRxEventReactor_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdRxEventReactor_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdRxEventReactor createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdRxEventReactor_createObject();
			OdRxEventReactor result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdRxEventReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdRxEventReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdRxEventReactor)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void dwgFileOpened(OdDbDatabase pDb, string filename)
		{
			TD_DbPINVOKE.OdRxEventReactor_dwgFileOpened(this.swigCPtr, OdDbDatabase.getCPtr(pDb), filename);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void initialDwgFileOpenComplete(OdDbDatabase pDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_initialDwgFileOpenComplete(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void databaseConstructed(OdDbDatabase pDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_databaseConstructed(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void databaseToBeDestroyed(OdDbDatabase pDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_databaseToBeDestroyed(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void beginSave(OdDbDatabase pDb, string intendedName)
		{
			TD_DbPINVOKE.OdRxEventReactor_beginSave(this.swigCPtr, OdDbDatabase.getCPtr(pDb), intendedName);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void saveComplete(OdDbDatabase pDb, string actualName)
		{
			TD_DbPINVOKE.OdRxEventReactor_saveComplete(this.swigCPtr, OdDbDatabase.getCPtr(pDb), actualName);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void abortSave(OdDbDatabase pDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_abortSave(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void beginDxfIn(OdDbDatabase pDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_beginDxfIn(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void abortDxfIn(OdDbDatabase pDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_abortDxfIn(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void dxfInComplete(OdDbDatabase pDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_dxfInComplete(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void beginDxfOut(OdDbDatabase pDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_beginDxfOut(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void abortDxfOut(OdDbDatabase pDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_abortDxfOut(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void dxfOutComplete(OdDbDatabase pDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_dxfOutComplete(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void beginInsert(OdDbDatabase pToDb, string blockName, OdDbDatabase pFromDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_beginInsert__SWIG_0(this.swigCPtr, OdDbDatabase.getCPtr(pToDb), blockName, OdDbDatabase.getCPtr(pFromDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void beginInsert(OdDbDatabase pToDb, OdGeMatrix3d xfm, OdDbDatabase pFromDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_beginInsert__SWIG_1(this.swigCPtr, OdDbDatabase.getCPtr(pToDb), OdGeMatrix3d.getCPtr(xfm), OdDbDatabase.getCPtr(pFromDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void otherInsert(OdDbDatabase pToDb, OdDbIdMapping idMap, OdDbDatabase pFromDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_otherInsert(this.swigCPtr, OdDbDatabase.getCPtr(pToDb), OdDbIdMapping.getCPtr(idMap), OdDbDatabase.getCPtr(pFromDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void abortInsert(OdDbDatabase pToDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_abortInsert(this.swigCPtr, OdDbDatabase.getCPtr(pToDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void endInsert(OdDbDatabase pToDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_endInsert(this.swigCPtr, OdDbDatabase.getCPtr(pToDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void wblockNotice(OdDbDatabase pFromDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_wblockNotice(this.swigCPtr, OdDbDatabase.getCPtr(pFromDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void beginWblock(OdDbDatabase pToDb, OdDbDatabase pFromDb, OdGePoint3d insertionPoint)
		{
			TD_DbPINVOKE.OdRxEventReactor_beginWblock__SWIG_0(this.swigCPtr, OdDbDatabase.getCPtr(pToDb), OdDbDatabase.getCPtr(pFromDb), OdGePoint3d.getCPtr(insertionPoint));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void beginWblock(OdDbDatabase pToDb, OdDbDatabase pFromDb, OdDbObjectId blockId)
		{
			TD_DbPINVOKE.OdRxEventReactor_beginWblock__SWIG_1(this.swigCPtr, OdDbDatabase.getCPtr(pToDb), OdDbDatabase.getCPtr(pFromDb), OdDbObjectId.getCPtr(blockId));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void beginWblock(OdDbDatabase pToDb, OdDbDatabase pFromDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_beginWblock__SWIG_2(this.swigCPtr, OdDbDatabase.getCPtr(pToDb), OdDbDatabase.getCPtr(pFromDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void otherWblock(OdDbDatabase pToDb, OdDbIdMapping idMap, OdDbDatabase pFromDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_otherWblock(this.swigCPtr, OdDbDatabase.getCPtr(pToDb), OdDbIdMapping.getCPtr(idMap), OdDbDatabase.getCPtr(pFromDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void abortWblock(OdDbDatabase pToDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_abortWblock(this.swigCPtr, OdDbDatabase.getCPtr(pToDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void endWblock(OdDbDatabase pToDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_endWblock(this.swigCPtr, OdDbDatabase.getCPtr(pToDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void beginWblockObjects(OdDbDatabase pFromDb, OdDbIdMapping idMap)
		{
			TD_DbPINVOKE.OdRxEventReactor_beginWblockObjects(this.swigCPtr, OdDbDatabase.getCPtr(pFromDb), OdDbIdMapping.getCPtr(idMap));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void beginDeepClone(OdDbDatabase pToDb, OdDbIdMapping idMap)
		{
			TD_DbPINVOKE.OdRxEventReactor_beginDeepClone(this.swigCPtr, OdDbDatabase.getCPtr(pToDb), OdDbIdMapping.getCPtr(idMap));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void beginDeepCloneXlation(OdDbIdMapping idMap)
		{
			TD_DbPINVOKE.OdRxEventReactor_beginDeepCloneXlation(this.swigCPtr, OdDbIdMapping.getCPtr(idMap));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void abortDeepClone(OdDbIdMapping idMap)
		{
			TD_DbPINVOKE.OdRxEventReactor_abortDeepClone(this.swigCPtr, OdDbIdMapping.getCPtr(idMap));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void endDeepClone(OdDbIdMapping idMap)
		{
			TD_DbPINVOKE.OdRxEventReactor_endDeepClone(this.swigCPtr, OdDbIdMapping.getCPtr(idMap));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void partialOpenNotice(OdDbDatabase pDb)
		{
			TD_DbPINVOKE.OdRxEventReactor_partialOpenNotice(this.swigCPtr, OdDbDatabase.getCPtr(pDb));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
